home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume15 / dmake-3.6 / part15 < prev    next >
Encoding:
Text File  |  1990-10-14  |  39.5 KB  |  1,058 lines

  1. Newsgroups: comp.sources.misc
  2. X-UNIX-From: dvadura@watdragon.waterloo.edu
  3. subject: v15i067: dmake version 3.6 (part 15/25)
  4. from: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 15, Issue 67
  8. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  9. Archive-name: dmake-3.6/part15
  10.  
  11. #!/bin/sh
  12. # this is part 15 of a multipart archive
  13. # do not concatenate these parts, unpack them in order with /bin/sh
  14. # file man/dmake.p continued
  15. #
  16. CurArch=15
  17. if test ! -r s2_seq_.tmp
  18. then echo "Please unpack part 1 first!"
  19.      exit 1; fi
  20. ( read Scheck
  21.   if test "$Scheck" != $CurArch
  22.   then echo "Please unpack part $Scheck next!"
  23.        exit 1;
  24.   else exit 0; fi
  25. ) < s2_seq_.tmp || exit 1
  26. echo "x - Continuing file man/dmake.p"
  27. sed 's/^X//' << 'SHAR_EOF' >> man/dmake.p
  28. X     a target having the .LIBMEMBER (library member) attribute is
  29. X     searched for, it is first searched for as an ordinary file.
  30. X     When a number of library members require updating it is
  31. X     desirable to compile all of them first and to update the
  32. X     library at the end in a single operation.  If one of the
  33. X     members does not compile and ddmmaakkee stops, then the user may
  34. X     fix the error and make again.  ddmmaakkee will not remake any of
  35. X     the targets whose object files have already been generated
  36. X     as long as none of their prerequisite files have been modi-
  37. X     fied as a result of the fix.
  38. X
  39. X     When defining .SOURCE and .SOURCE.x targets the construct
  40. X
  41. X
  42. X
  43. X
  44. XVersion 3.50                    UW                             30
  45. X
  46. X
  47. X
  48. X
  49. XDMAKE(p)               Unsupported Software               DMAKE(p)
  50. X
  51. X
  52. X
  53. X          .SOURCE :
  54. X          .SOURCE : fred gery
  55. X
  56. X     is equivalent to
  57. X
  58. X          .SOURCE :- fred gery
  59. X
  60. X     ddmmaakkee correctly handles the UNIX Make variable VPATH.  By
  61. X     definition VPATH contains a list of ':' separated direc-
  62. X     tories to search when looking for a target.  ddmmaakkee maps
  63. X     VPATH to the following special rule:
  64. X
  65. X          .SOURCE :^ $(VPATH:s/:/ /)
  66. X
  67. X     Which takes the value of VPATH and sets .SOURCE to the same
  68. X     set of directories as specified in VPATH.
  69. X
  70. XPPEERRCCEENNTT((%%)) RRUULLEESS AANNDD MMAAKKIINNGG IINNFFEERREENNCCEESS
  71. X     When ddmmaakkee makes a target it's set of prerequisites (if any)
  72. X     must exist and the target must have a recipe which ddmmaakkee can
  73. X     use to make it.  If the makefile does not specify an expli-
  74. X     cit recipe for the target then ddmmaakkee uses special rules to
  75. X     try to infer a recipe which it can use to make the target.
  76. X     Previous versions of Make perform this task by using rules
  77. X     that are defined by targets of the form .<suffix>.<suffix>
  78. X     and by using the .SUFFIXES list of suffixes.  The exact
  79. X     workings of this mechanism were sometimes difficult to
  80. X     understand and often limiting in their usefulness.  Instead,
  81. X     ddmmaakkee supports the concept of _%_-_m_e_t_a rules. The syntax and
  82. X     semantics of these rules differ from standard rule lines as
  83. X     follows:
  84. X
  85. X          _<_%_-_t_a_r_g_e_t_> [_<_a_t_t_r_i_b_u_t_e_s_>] _<_r_u_l_e_o_p_> [_<_%_-_p_r_e_r_e_q_u_i_s_i_t_e_s_>] [;_<_r_e_c_i_p_e_>]
  86. X
  87. X     where _%_-_t_a_r_g_e_t is a target containing exactly a single `%'
  88. X     sign, _a_t_t_r_i_b_u_t_e_s is a list (possibly empty) of attributes,
  89. X     _r_u_l_e_o_p is the standard set of rule operators, _%_-_p_r_e_r_e_-
  90. X     _q_u_i_s_i_t_e_s , if present, is a list of prerequisites containing
  91. X     zero or more `%' signs, and _r_e_c_i_p_e_, if present, is the first
  92. X     line of the recipe.
  93. X
  94. X     The _%_-_t_a_r_g_e_t defines a pattern against which a target whose
  95. X     recipe is being inferred gets matched.  The pattern match
  96. X     goes as follows:  all chars are matched exactly from left to
  97. X     right up to but not including the % sign in the pattern, %
  98. X     then matches the longest string from the actual target name
  99. X     not ending in the suffix given after the % sign in the pat-
  100. X     tern.  Consider the following examples:
  101. X
  102. X          %.c       matches fred.c but not joe.c.Z
  103. X          dir/%.c   matches dir/fred.c but not dd/fred.c
  104. X          fred/%    matches fred/joe.c but not f/joe.c
  105. X
  106. X
  107. X
  108. XVersion 3.50                    UW                             31
  109. X
  110. X
  111. X
  112. X
  113. XDMAKE(p)               Unsupported Software               DMAKE(p)
  114. X
  115. X
  116. X
  117. X          %         matches anything
  118. X
  119. X     In each case the part of the target name that matched the %
  120. X     sign is retained and is substituted for any % signs in the
  121. X     prerequisite list of the %-meta rule when the rule is
  122. X     selected during inference and ddmmaakkee constructs the depen-
  123. X     dency specified by the %-meta rule for the actual target.
  124. X     As an example the following %-meta rules describe the fol-
  125. X     lowing:
  126. X
  127. X          %.c : %.y ; recipe...
  128. X
  129. X     describes how to make any file ending in .c if a correspond-
  130. X     ing file ending in .y can be found.
  131. X
  132. X          foo%.o : fee%.k ; recipe...
  133. X
  134. X     is used to describe how to make fooxxxx.o from feexxxx.k.
  135. X
  136. X          %.a :; recipe...
  137. X
  138. X     describes how to make a file whose suffix is .a without
  139. X     inferring any prerequisites.
  140. X
  141. X          %.c : %.y yaccsrc/%.y ; recipe...
  142. X
  143. X     is a short form for the construct:
  144. X
  145. X          %.c : %.y ; recipe...
  146. X          %.c : yaccsrc/%.y ; recipe...
  147. X
  148. X     ie. It is possible to specify the same recipe for two
  149. X     %-rules by giving more than one prerequisite in the prere-
  150. X     quisite list.  A more interesting example is:
  151. X
  152. X          % : RCS/%,v ; co $@
  153. X
  154. X     which describes how to take any target and check it out of
  155. X     the RCS directory if the corresponding file exists in the
  156. X     RCS directory.  The equivalent SCCS rule would be:
  157. X
  158. X          % : s.% ; get $@
  159. X
  160. X
  161. X     The previous RCS example defines an infinite rule, because
  162. X     it says how to make _a_n_y_t_h_i_n_g from RCS/%,v, and _a_n_y_t_h_i_n_g also
  163. X     includes RCS/fred.c,v.  To limit the size of the graph that
  164. X     results from such rules ddmmaakkee uses the macro variable PREP
  165. X     (stands for % repetition).  By default the value of this
  166. X     variable is 0, which says that no repetitions of a %-rule
  167. X     are to be generated.  If it is set to something greater than
  168. X     0, then that many repetitions of any infinite %-rule are
  169. X
  170. X
  171. X
  172. XVersion 3.50                    UW                             32
  173. X
  174. X
  175. X
  176. X
  177. XDMAKE(p)               Unsupported Software               DMAKE(p)
  178. X
  179. X
  180. X
  181. X     allowed.  If in the above example PREP was set to 1, then
  182. X     ddmmaakkee would generate the dependency graph:
  183. X
  184. X          % --> RCS/%,v --> RCS/RCS/%,v,v
  185. X
  186. X     Where each link is assigned the same recipe as the first
  187. X     link.  PREP should be used only in special cases, since it
  188. X     may result in a large increase in the number of possible
  189. X     prerequisites tested.
  190. X
  191. X     ddmmaakkee supports dynamic prerequisite generation for prere-
  192. X     quisites of %-meta rules.  This is best illustrated by an
  193. X     example.  The RCS rule shown above can infer how to check
  194. X     out a file from a corresponding RCS file only if the target
  195. X     is a simple file name with no directory information.  That
  196. X     is, the above rule can infer how to find _R_C_S_/_f_r_e_d_._c_,_v from
  197. X     the target _f_r_e_d_._c, but cannot infer how to find
  198. X     _s_r_c_d_i_r_/_R_C_S_/_f_r_e_d_._c_,_v from _s_r_c_d_i_r_/_f_r_e_d_._c because the above
  199. X     rule will cause ddmmaakkee to look for RCS/srcdir/fred.c,v; which
  200. X     does not exist (assume that srcdir has it's own RCS direc-
  201. X     tory as is the common case).
  202. X
  203. X     A more versatile formulation of the above RCS check out rule
  204. X     is the following:
  205. X
  206. X          % :  $$(@:d)RCS/$$(@:f),v : co $@
  207. X
  208. X     This rule uses the dynamic macro $@ to specify the prere-
  209. X     quisite to try to infer.  During inference of this rule the
  210. X     macro $@ is set to the value of the target of the %-meta
  211. X     rule and the appropriate prerequisite is generated by
  212. X     extracting the directory portion of the target name (if
  213. X     any), appending the string _R_C_S_/ to it, and appending the
  214. X     target file name with a trailing _,_v attached to the previous
  215. X     result.
  216. X
  217. X     ddmmaakkee can also infer indirect prerequisites.  An inferred
  218. X     target can have a list of prerequisites added that will not
  219. X     show up in the value of $< but will show up in the value of
  220. X     $? and $&.  Indirect prerequisites are specified in an
  221. X     inference rule by quoting the prerequisite with single
  222. X     quotes.  For example, if you had the explicit dependency:
  223. X
  224. X          fred.o : fred.c ; rule to make fred.o
  225. X          fred.o : local.h
  226. X
  227. X     then this can be infered for fred.o from the following
  228. X     inference rule:
  229. X
  230. X          %.o : %.c 'local.h' ; rule to make a .o from a .c
  231. X
  232. X     You may infer indirect prerequisites that are a function of
  233. X
  234. X
  235. X
  236. XVersion 3.50                    UW                             33
  237. X
  238. X
  239. X
  240. X
  241. XDMAKE(p)               Unsupported Software               DMAKE(p)
  242. X
  243. X
  244. X
  245. X     the value of '%' in the current rule.  The meta-rule:
  246. X
  247. X          %.o : %.c '$(INC)/%.h' ; rule to make a .o from a .c
  248. X
  249. X     infers an indirect prerequisite found in the INC directory
  250. X     whose name is the same as the expansion of $(INC), and the
  251. X     prerequisite name depends on the base name of the current
  252. X     target.  The set of indirect prerequisites is attached to
  253. X     the meta rule in which they are specified and are inferred
  254. X     only if the rule is used to infer a recipe for a target.
  255. X     They do not play an active role in driving the inference
  256. X     algorithm.  The construct:
  257. X
  258. X          %.o : %.c %.f 'local.h'; recipe
  259. X
  260. X     is equivalent to:
  261. X
  262. X          %.o : %.c 'local.h' : recipe
  263. X          %.o : %.f 'local.h' : recipe
  264. X
  265. X
  266. X     If any of the attributes .SETDIR, .EPILOG, .PROLOG, .SILENT,
  267. X     .USESHELL, .SWAP, .PRECIOUS, .LIBRARY, and .IGNORE are given
  268. X     for a %-rule then when that rule is bound to a target as the
  269. X     result of an inference, the target's set of attributes is
  270. X     augmented by the attributes from the above set that are
  271. X     specified in the bound %-rule.  Other attributes specified
  272. X     for %-meta rules are not inherited by the target.  The .SET-
  273. X     DIR attribute is treated in a special way.  If the target
  274. X     already had a .SETDIR attribute set and the bound %-rule
  275. X     also specified a .SETDIR attribute then the one originally
  276. X     specified with the target prevails.  During inference any
  277. X     .SETDIR attributes for the inferred prerequisite are
  278. X     honored.  The directories must exist for a %-meta rule to be
  279. X     selected as a possible inference path.  If the directories
  280. X     do not exist no error message is issued, instead the
  281. X     corresponding path in the inference graph is simply
  282. X     rejected.
  283. X
  284. X     ddmmaakkee also supports the old format special target
  285. X     .<suffix>.<suffix> by identifying any rules of this form and
  286. X     mapping them to the appropriate %-rule.  So for example if
  287. X     an old makefile contains the construct:
  288. X
  289. X          .c.o :; cc -c $< -o $@
  290. X
  291. X     ddmmaakkee maps this into the following %-rule:
  292. X
  293. X          %.o : %.c; cc -c $< -o $@
  294. X
  295. X     Furthermore, ddmmaakkee understands several SYSV AUGMAKE special
  296. X     targets and maps them into corresponding %-meta rules.
  297. X
  298. X
  299. X
  300. XVersion 3.50                    UW                             34
  301. X
  302. X
  303. X
  304. X
  305. XDMAKE(p)               Unsupported Software               DMAKE(p)
  306. X
  307. X
  308. X
  309. X     These transformation must be enabled by providing the -A
  310. X     flag on the command line or by setting the value of AUGMAKE
  311. X     to non NULL.  The construct
  312. X
  313. X          .suff :; recipe
  314. X
  315. X     gets mapped into:
  316. X
  317. X          % : %.suff; recipe
  318. X
  319. X     and the construct
  320. X
  321. X          .c~.o :; recipe
  322. X
  323. X     gets mapped into:
  324. X
  325. X          %.o : s.%.c ; recipe
  326. X
  327. X     In general, a special target of the form .<str>~ is replaced
  328. X     by the %-rule construct s.%.<str>, thereby providing support
  329. X     for the syntax used by SYSV AUGMAKE for providing SCCS sup-
  330. X     port.  When enabled, these mappings allow processing of
  331. X     existing SYSV makefiles without modifications.
  332. X
  333. X     ddmmaakkee bases all of it's inferences on the inference graph
  334. X     constructed from the %-rules defined in the makefile.  It
  335. X     knows exactly which targets can be made from which prere-
  336. X     quisites by making queries on the inference graph.  For this
  337. X     reason .SUFFIXES is not needed and is completely ignored.
  338. X
  339. X     For a %-meta rule to be inferred as the rule whose recipe
  340. X     will be used to make a target, the target's name must match
  341. X     the %-target pattern, and any inferred %-prerequisite must
  342. X     already exist or have an explicit recipe so that the prere-
  343. X     quisite can be made.  Without _t_r_a_n_s_i_t_i_v_e _c_l_o_s_u_r_e on the
  344. X     inference graph the above rule describes precisely when an
  345. X     inference match terminates the search.  If transitive clo-
  346. X     sure is enabled (the usual case), and a prerequisite does
  347. X     not exist or cannot be made, then ddmmaakkee invokes the infer-
  348. X     ence algorithm recursively on the prerequisite to see if
  349. X     there is some way the prerequisite can be manufactured.  For
  350. X     if the prerequisite can be made then the current target can
  351. X     also be made using the current %-meta rule.  This means that
  352. X     there is no longer a need to give a rule for making a .o
  353. X     from a .y if you have already given a rule for making a .o
  354. X     from a .c and a .c from a .y.  In such cases ddmmaakkee can infer
  355. X     how to make the .o from the .y via the intermediary .c and
  356. X     will remove the .c when the .o is made.  Transitive closure
  357. X     can be disabled by giving the -T switch on the command line.
  358. X
  359. X     A word of caution.  ddmmaakkee bases its transitive closure on
  360. X     the %-meta rule targets.  When it performs transitive
  361. X
  362. X
  363. X
  364. XVersion 3.50                    UW                             35
  365. X
  366. X
  367. X
  368. X
  369. XDMAKE(p)               Unsupported Software               DMAKE(p)
  370. X
  371. X
  372. X
  373. X     closure it infers how to make a target from a prerequisite
  374. X     by performing a pattern match as if the potential prere-
  375. X     quisite were a new target.  The set of rules:
  376. X
  377. X          %.o : %.c :; rule for making .o from .c
  378. X          %.c : %.y :; rule for making .c from .y
  379. X          % : RCS/%,v :; check out of RCS file
  380. X
  381. X     will, by performing transitive closure, allow ddmmaakkee to infer
  382. X     how to make a .o from a .y using a .c as an intermediate
  383. X     temporary file.  Additionally it will be able to infer how
  384. X     to make a .y from an RCS file, as long as that RCS file is
  385. X     in the RCS directory and has a name which ends in .y,v.  The
  386. X     transitivity computation is performed dynamically for each
  387. X     target that does not have a recipe.  This has potential to
  388. X     be very slow if the %-meta rules are not carefully speci-
  389. X     fied.  The .NOINFER attribute is used to mark a %-meta node
  390. X     as being a final target during inference.  Any node with
  391. X     this attribute set will not be used for subsequent infer-
  392. X     ences.  As an example the node RCS/%,v is marked as a final
  393. X     node since we know that if the RCS file does not exist there
  394. X     likely is no other way to make it.  Thus the standard
  395. X     startup makefile contains the entry:
  396. X          .NOINFER : RCS/%,v
  397. X     Thereby indicating that the RCS file is the end of the
  398. X     inference chain.
  399. X
  400. X     ddmmaakkee tries to remove intermediate files resulting from
  401. X     transitive closure if the file is not marked as being PRE-
  402. X     CIOUS, or the --uu flag was not given on the command line, and
  403. X     if the inferred intermediate did not previously exist.
  404. X     Intermediate targets that existed prior to being made are
  405. X     never removed.  This is in keeping with the philosophy that
  406. X     ddmmaakkee should never remove things from the file system that
  407. X     it did not add.  If the special target .REMOVE is defined
  408. X     and has a recipe then ddmmaakkee constructs a list of the inter-
  409. X     mediate files to be removed and makes them prerequisites of
  410. X     .REMOVE.  It then makes .REMOVE thereby removing the prere-
  411. X     quisites if the recipe of .REMOVE says to.  Typically
  412. X     .REMOVE is defined in the startup file as:
  413. X
  414. X          ".REMOVE :; $(RM) $<".
  415. X
  416. XMMAAKKIINNGG TTAARRGGEETTSS
  417. X     In order to update a target ddmmaakkee must execute a recipe.
  418. X     When a recipe needs to be executed it is first expanded so
  419. X     that any macros in the recipe text are expanded, and it is
  420. X     then either executed directly or passed to a shell.  ddmmaakkee
  421. X     supports two types of recipes.  The regular recipes and
  422. X     group recipes.
  423. X
  424. X
  425. X
  426. X
  427. X
  428. XVersion 3.50                    UW                             36
  429. X
  430. X
  431. X
  432. X
  433. XDMAKE(p)               Unsupported Software               DMAKE(p)
  434. X
  435. X
  436. X
  437. X     When a regular recipe is invoked ddmmaakkee executes each line of
  438. X     the recipe separately using a new copy of a shell if a shell
  439. X     is required.  Thus effects of commands do not generally per-
  440. X     sist across recipe lines.  (e.g. cd requests in a recipe
  441. X     line do not carry over to the next recipe line) The decision
  442. X     on whether a shell is required to execute a command is based
  443. X     on the value of the macro SHELLMETAS or on the specification
  444. X     of '+' or .USESHELL for the current recipe or target respec-
  445. X     tively.  If any character in the value of SHELLMETAS is
  446. X     found in the expanded recipe text-line or the use of a shell
  447. X     is requested explicitly via '+' or .USESHELL then the com-
  448. X     mand is executed using a shell, otherwise the command is
  449. X     executed directly.  The shell that is used for execution is
  450. X     given by the value of the macro SHELL.  The flags that are
  451. X     passed to the shell are given by the value of SHELLFLAGS.
  452. X     Thus ddmmaakkee constructs the command line:
  453. X
  454. X          $(SHELL) $(SHELLFLAGS) $(expanded_recipe_command)
  455. X
  456. X     Normally ddmmaakkee writes the command line that it is about to
  457. X     invoke to standard output.  If the .SILENT attribute is set
  458. X     for the target or for the recipe line (via @), then the
  459. X     recipe line is not echoed.
  460. X
  461. X     Group recipe processing is similar to that of regular
  462. X     recipes, except that a shell is always invoked.  The shell
  463. X     that is invoked is given by the value of the macro GROUP-
  464. X     SHELL, and its flags are taken from the value of the macro
  465. X     GROUPFLAGS.  If a target has the .PROLOG attribute set then
  466. X     ddmmaakkee prepends to the shell script the recipe associated
  467. X     with the special target .GROUPPROLOG, and if the attribute
  468. X     .EPILOG is set as well, then the recipe associated with the
  469. X     special target .GROUPEPILOG is appended to the script file.
  470. X     This facility can be used to always prepend a common header
  471. X     and common trailer to group recipes.  Group recipes are
  472. X     echoed to standard output just like standard recipes, but
  473. X     are enclosed by lines beginning with [ and ].
  474. X
  475. XMMAAKKIINNGG LLIIBBRRAARRIIEESS
  476. X     Libraries are easy to maintain using ddmmaakkee.  A library is a
  477. X     file containing a collection of object files.  Thus to make
  478. X     a library you simply specify it as a target with the
  479. X     .LIBRARY attribute set and specify its list of prere-
  480. X     quisites.  The prerequisites should be the object members
  481. X     that are to go into the library.  When ddmmaakkee makes the
  482. X     library target it uses the .LIBRARY attribute to pass to the
  483. X     prerequisites the .LIBMEMBER attribute and the name of the
  484. X     library.  This enables the file binding mechanism to look
  485. X     for the member in the library if an appropriate object file
  486. X     cannot be found. A small example best illustrates this.
  487. X
  488. X          mylib.a .LIBRARY : mem1.o mem2.o mem3.o
  489. X
  490. X
  491. X
  492. XVersion 3.50                    UW                             37
  493. X
  494. X
  495. X
  496. X
  497. XDMAKE(p)               Unsupported Software               DMAKE(p)
  498. X
  499. X
  500. X
  501. X               rules for making library...
  502. X               # remember to remove .o's when lib is made
  503. X
  504. X          # equivalent to:  '%.o : %.c ; ...'
  505. X          .c.o :; rules for making .o from .c say
  506. X
  507. X     ddmmaakkee will use the .c.o rule for making the library members
  508. X     if appropriate .c files can be found using the search rules.
  509. X     NOTE:  this is not specific in any way to C programs, they
  510. X     are simply used as an example.
  511. X
  512. X     ddmmaakkee tries to handle the old library construct format in a
  513. X     sensible way.  The construct _l_i_b_(_m_e_m_b_e_r_._o_) is separated and
  514. X     the _l_i_b portion is declared as a library target.  The new
  515. X     target is defined with the .LIBRARY attribute set and the
  516. X     _m_e_m_b_e_r_._o portion of the construct is declared as a prere-
  517. X     quisite of the lib target.  If the construct _l_i_b_(_m_e_m_b_e_r_._o_)
  518. X     appears as a prerequisite of a target in the makefile, that
  519. X     target has the new name of the lib assigned as it's prere-
  520. X     quisite.  Thus the following example:
  521. X
  522. X          a.out : ml.a(a.o) ml.a(b.o); $(CC) -o $@  $<
  523. X
  524. X          .c.o :; $(CC) -c $(CFLAGS) -o $@  $<
  525. X          %.a:
  526. X               ar rv $@ $<
  527. X               ranlib $@
  528. X               rm -rf $<
  529. X
  530. X     constructs the following dependency graph.
  531. X
  532. X          a.out : ml.a; $(CC) -o $@  $<
  533. X          ml.a .LIBRARY : a.o b.o
  534. X
  535. X          %.o : %.c ; $(CC) -c $(CFLAGS) -o $@  $<
  536. X          %.a :
  537. X               ar rv $@ $<
  538. X               ranlib $@
  539. X               rm -rf $<
  540. X
  541. X     and making a.out then works as expected.
  542. X
  543. X     The same thing happens for any target of the form
  544. X     _l_i_b_(_(_e_n_t_r_y_)_).  These targets have an additional feature in
  545. X     that the _e_n_t_r_y target has the .SYMBOL attribute set automat-
  546. X     ically.
  547. X
  548. X     NOTE:  If the notion of entry points is supported by the
  549. X     archive and by ddmmaakkee (currently not the case) then ddmmaakkee
  550. X     will search the archive for the entry point and return not
  551. X     only the modification time of the member which defines the
  552. X     entry but also the name of the member file.  This name will
  553. X
  554. X
  555. X
  556. XVersion 3.50                    UW                             38
  557. X
  558. X
  559. X
  560. X
  561. XDMAKE(p)               Unsupported Software               DMAKE(p)
  562. X
  563. X
  564. X
  565. X     then replace _e_n_t_r_y and will be used for making the member
  566. X     file.  Once bound to an archive member the .SYMBOL attribute
  567. X     is removed from the target.  This feature is presently dis-
  568. X     abled as there is little standardization among archive for-
  569. X     mats, and we have yet to find a makefile utilizing this
  570. X     feature (possibly due to the fact that it is unimplemented
  571. X     in most versions of UNIX Make).
  572. X
  573. XMMUULLTTII PPRROOCCEESSSSIINNGG
  574. X     If the architecture supports it then ddmmaakkee is capable of
  575. X     making a target's prerequisites in parallel.  ddmmaakkee will
  576. X     make as much in parallel as it can and use a number of child
  577. X     processes up to the maximum specified by MAXPROCESS or by
  578. X     the value supplied to the -P command line flag.  A parallel
  579. X     make is enabled by setting the value of MAXPROCESS (either
  580. X     directly or via -P option) to a value which is > 1.  ddmmaakkee
  581. X     guarantees that all dependencies as specified in the
  582. X     makefile are honored.  A target will not be made until all
  583. X     of its prerequisites have been made.  If a parallel make is
  584. X     being performed then the following restrictions on parallel-
  585. X     ism are enforced.
  586. X
  587. X          1.   Individual recipe lines in a non-group recipe are
  588. X               performed sequentially in the order in which they
  589. X               are specified within the makefile and in parallel
  590. X               with the recipes of other targets.
  591. X
  592. X          2.   If a target contains multiple recipe definitions
  593. X               (cf. :: rules) then these are performed sequen-
  594. X               tially in the order in which the :: rules are
  595. X               specified within the makefile and in parallel with
  596. X               the recipes of other targets.
  597. X
  598. X          3.   If a target rule contains the `!' modifier, then
  599. X               the recipe is performed sequentially for the list
  600. X               of outdated prerequisites and in parallel with the
  601. X               recipes of other targets.
  602. X
  603. X          4.   If a target has the .SEQUENTIAL attribute set then
  604. X               all of its prerequisites are made sequentially
  605. X               relative to one another (as if MAXPROCESS=1), but
  606. X               in parallel with other targets in the makefile.
  607. X
  608. X     Note:  If you specify a parallel make then the order of tar-
  609. X     get update and the order in which the associated recipes are
  610. X     invoked will not correspond to that displayed by the -n
  611. X     flag.
  612. X
  613. XCCOONNDDIITTIIOONNAALLSS
  614. X     ddmmaakkee supports a makefile construct called a _c_o_n_d_i_t_i_o_n_a_l.
  615. X     It allows the user to conditionally select portions of
  616. X     makefile text for input processing and to discard other
  617. X
  618. X
  619. X
  620. XVersion 3.50                    UW                             39
  621. X
  622. X
  623. X
  624. X
  625. XDMAKE(p)               Unsupported Software               DMAKE(p)
  626. X
  627. X
  628. X
  629. X     portions.  This becomes useful for writing makefiles that
  630. X     are intended to function for more than one target host and
  631. X     environment.  The conditional expression is specified as
  632. X     follows:
  633. X
  634. X          .IF  _e_x_p_r_e_s_s_i_o_n
  635. X             ... if text ...
  636. X          .ELSE
  637. X             ... else text ...
  638. X          .END
  639. X
  640. X     The .ELSE portion is optional, and the conditionals may be
  641. X     nested (ie.  the text may contain another conditional).
  642. X     .IF, .ELSE, and .END may appear anywhere in the makefile,
  643. X     but a single conditional expression may not span multiple
  644. X     makefiles.
  645. X
  646. X     _e_x_p_r_e_s_s_i_o_n can be one of the following three forms:
  647. X
  648. X          <text> | <text> == <text> | <text> != <text>
  649. X
  650. X     where _t_e_x_t is either text or a macro expression.  In any
  651. X     case, before the comparison is made, the expression is
  652. X     expanded.  The text portions are then selected and compared.
  653. X     White space at the start and end of the text portion is dis-
  654. X     carded before the comparison.  This means that a macro that
  655. X     evaluates to nothing but white space is considered a NULL
  656. X     value for the purpose of the comparison.  In the first case
  657. X     the expression evaluates TRUE if the text is not NULL other-
  658. X     wise it evaluates FALSE.  The remaining two cases both
  659. X     evaluate the expression on the basis of a string comparison.
  660. X     If a macro expression needs to be equated to a NULL string
  661. X     then compare it to the value of the macro $(NULL).
  662. X
  663. XEEXXAAMMPPLLEESS
  664. X          # A simple example showing how to use make
  665. X          #
  666. X          prgm : a.o b.o
  667. X               cc a.o b.o -o prgm
  668. X          a.o : a.c g.h
  669. X               cc a.c -o $@
  670. X          b.o : b.c g.h
  671. X               cc b.c -o $@
  672. X
  673. X     In the previous example prgm is remade only if a.o and/or
  674. X     b.o is out of date with respect to prgm.  These dependencies
  675. X     can be stated more concisely by using the inference rules
  676. X     defined in the standard startup file.  The default rule for
  677. X     making .o's from .c's looks something like this:
  678. X
  679. X          %.o : %.c; cc -c $(CFLAGS) -o $@ $<
  680. X
  681. X
  682. X
  683. X
  684. XVersion 3.50                    UW                             40
  685. X
  686. X
  687. X
  688. X
  689. XDMAKE(p)               Unsupported Software               DMAKE(p)
  690. X
  691. X
  692. X
  693. X     Since there exists a rule (defined in the startup file) for
  694. X     making .o's from .c's ddmmaakkee will use that rule for manufac-
  695. X     turing a .o from a .c and we can specify our dependencies
  696. X     more concisely.
  697. X
  698. X          prgm : a.o b.o
  699. X               cc -o prgm $<
  700. X          a.o b.o : g.h
  701. X
  702. X     A more general way to say the above using the new macro
  703. X     expansions would be:
  704. X
  705. X          SRC = a b
  706. X          OBJ = {$(SRC)}.o
  707. X
  708. X          prgm : $(OBJ)
  709. X               cc -o $@ $<
  710. X
  711. X          $(OBJ) : g.h
  712. X
  713. X     If we want to keep the objects in a separate directory,
  714. X     called objdir, then we would write something like this.
  715. X
  716. X          SRC = a b
  717. X          OBJ = {$(SRC)}.o
  718. X
  719. X          prgm : $(OBJ)
  720. X               cc $< -o $@
  721. X
  722. X          $(OBJ) : g.h
  723. X          %.o : %.c
  724. X               $(CC) -c $(CFLAGS) -o $(@:f) $<
  725. X               mv $(@:f) objdir
  726. X
  727. X          .SOURCE.o : objdir       # tell make to look here for .o's
  728. X
  729. X     An example of building library members would go something
  730. X     like this: (NOTE:  The same rules as above will be used to
  731. X     produce .o's from .c's)
  732. X
  733. X          SRC  = a b
  734. X          LIB  = lib
  735. X          LIBm = { $(SRC) }.o
  736. X
  737. X          prgm: $(LIB)
  738. X               cc -o $@ $(LIB)
  739. X
  740. X          $(LIB) .LIBRARY : $(LIBm)
  741. X               ar rv $@ $<
  742. X               rm $<
  743. X
  744. X     Finally, suppose that each of the source files in the
  745. X
  746. X
  747. X
  748. XVersion 3.50                    UW                             41
  749. X
  750. X
  751. X
  752. X
  753. XDMAKE(p)               Unsupported Software               DMAKE(p)
  754. X
  755. X
  756. X
  757. X     previous example had the `:' character in their target name.
  758. X     Then we would write the above example as:
  759. X
  760. X          SRC  = f:a f:b
  761. X          LIB  = lib
  762. X          LIBm = "{ $(SRC) }.o"         # put quotes around each token
  763. X
  764. X          prgm: $(LIB)
  765. X               cc -o $@ $(LIB)
  766. X
  767. X          $(LIB) .LIBRARY : $(LIBm)
  768. X               ar rv $@ $<
  769. X               rm $<
  770. X
  771. XCCOOMMPPAATTIIBBIILLIITTYY
  772. X     There are two notable differences between ddmmaakkee and the
  773. X     standard version of BSD UNIX 4.2/4.3 Make.
  774. X
  775. X          1. BSD UNIX 4.2/4.3 Make supports wild card filename
  776. X             expansion for prerequisite names.  Thus if a direc-
  777. X             tory contains a.h, b.h and c.h, then a line like
  778. X
  779. X                  target: *.h
  780. X
  781. X             will cause UNIX make to expand the *.h into "a.h b.h
  782. X             c.h".  ddmmaakkee does not support this type of filename
  783. X             expansion.
  784. X
  785. X          2. Unlike UNIX make, touching a library member causes
  786. X             ddmmaakkee to search the library for the member name and
  787. X             to update the library time stamp.  This is only
  788. X             implemented in the UNIX version.  MSDOS and other
  789. X             versions may not have librarians that keep file time
  790. X             stamps, as a result ddmmaakkee touches the library file
  791. X             itself, and prints a warning.
  792. X
  793. X     ddmmaakkee is not compatible with GNU Make.  In particular it
  794. X     does not understand GNU Make's macro expansions that query
  795. X     the file system.
  796. X
  797. X     ddmmaakkee is fully compatible with SYSV AUGMAKE, and supports
  798. X     the following AUGMAKE features:
  799. X
  800. X          1. The word iinncclluuddee appearing at the start of a line
  801. X             can be used instead of the ".INCLUDE :" construct
  802. X             understood by ddmmaakkee.
  803. X
  804. X          2. The macro modifier expression $(macro:str=sub) is
  805. X             understood and is equivalent to the expression
  806. X             $(macro:s/str/sub), with the restriction that str
  807. X             must match the following regular expression:
  808. X
  809. X
  810. X
  811. X
  812. XVersion 3.50                    UW                             42
  813. X
  814. X
  815. X
  816. X
  817. XDMAKE(p)               Unsupported Software               DMAKE(p)
  818. X
  819. X
  820. X
  821. X                  str[ |\t][ |\t]*
  822. X
  823. X             (ie. str only matches at the end of a token where
  824. X             str is a suffix and is terminated by a space, a tab,
  825. X             or end of line)
  826. X
  827. X          3. The macro % is defined to be $@ (ie. $% expands to
  828. X             the same value as $@).
  829. X
  830. X          4. The AUGMAKE notion of libraries is handled
  831. X             correctly.
  832. X
  833. X          5. When defining special targets for the inference
  834. X             rules and the AUGMAKE special target mapping is
  835. X             enabled then the special target .X is equivalent to
  836. X             the %-rule "% : %.X".
  837. X
  838. XLLIIMMIITTSS
  839. X     In some environments the length of an argument string is
  840. X     restricted.  (e.g. MSDOS command line arguments cannot be
  841. X     longer than 128 bytes if you are using the standard
  842. X     command.com command interpreter as your shell, ddmmaakkee text
  843. X     diversions may help in these situations.)
  844. X
  845. XPPOORRTTAABBIILLIITTYY
  846. X     To write makefiles that can be moved from one environment to
  847. X     another requires some forethought.  In particular you must
  848. X     define as macros all those things that may be different in
  849. X     the new environment.  ddmmaakkee has two facilities that help to
  850. X     support writing portable makefiles, recursive macros and
  851. X     conditional expressions.  The recursive macros, allow one to
  852. X     define environment configurations that allow different
  853. X     environments for similar types of operating systems.  For
  854. X     example the same make script can be used for SYSV and BSD
  855. X     but with different macro definitions.
  856. X
  857. X     To write a makefile that is portable between UNIX and MSDOS
  858. X     requires both features since in almost all cases you will
  859. X     need to define new recipes for making targets.  The recipes
  860. X     will probably be quite different since the capabilities of
  861. X     the tools on each machine are different.  Different macros
  862. X     will be needed to help handle the smaller differences in the
  863. X     two environments.
  864. X
  865. X     NOTE:  Unlike UNIX, MSDOS ddooeess maintain cd requests cross
  866. X     single recipe lines.  This is not portable, and your
  867. X     makefiles will not work the same way if you depend on it.
  868. X     Use the .IF ... .ELSE ... .END conditionals to supply dif-
  869. X     ferent make scripts as necessary.
  870. X
  871. X
  872. X
  873. X
  874. X
  875. X
  876. XVersion 3.50                    UW                             43
  877. X
  878. X
  879. X
  880. X
  881. XDMAKE(p)               Unsupported Software               DMAKE(p)
  882. X
  883. X
  884. X
  885. XFFIILLEESS
  886. X     Makefile, makefile, startup.mk (use dmake -V to tell you
  887. X     where the startup file is)
  888. X
  889. XSSEEEE AALLSSOO
  890. X     sh(1), csh(1), touch(1), f77(1), pc(1), cc(1)
  891. X     S.I. Feldman  _M_a_k_e _- _A _P_r_o_g_r_a_m _f_o_r _M_a_i_n_t_a_i_n_i_n_g _C_o_m_p_u_t_e_r _P_r_o_-
  892. X     _g_r_a_m_s
  893. X
  894. XAAUUTTHHOORR
  895. X     Dennis Vadura, CS Dept. University of Waterloo.
  896. X     dvadura@watdragon.uwaterloo.ca
  897. X     Many thanks to Carl Seger for his helpful suggestions, and
  898. X     to Trevor John Thompson for his many excellent ideas and
  899. X     informative bug reports.
  900. X
  901. XBBUUGGSS
  902. X     Some system commands return non-zero status inappropriately.
  903. X     Use --ii (`-' within the makefile) to overcome the difficulty.
  904. X
  905. X     Some systems do not have easily accessible time stamps for
  906. X     library members (MSDOS, AMIGA, etc) for these ddmmaakkee uses the
  907. X     time stamp of the library instead and prints a warning the
  908. X     first time it does so.  This is almost always ok, except
  909. X     when multiple makefiles update a single library file.  In
  910. X     these instances it is possible to miss an update if one is
  911. X     not careful.
  912. X
  913. X
  914. X
  915. X
  916. X
  917. X
  918. X
  919. X
  920. X
  921. X
  922. X
  923. X
  924. X
  925. X
  926. X
  927. X
  928. X
  929. X
  930. X
  931. X
  932. X
  933. X
  934. X
  935. X
  936. X
  937. X
  938. X
  939. X
  940. XVersion 3.50                    UW                             44
  941. SHAR_EOF
  942. echo "File man/dmake.p is complete"
  943. chmod 0640 man/dmake.p || echo "restore of man/dmake.p fails"
  944. echo "x - extracting man/dmake.nc (Text)"
  945. sed 's/^X//' << 'SHAR_EOF' > man/dmake.nc &&
  946. X
  947. X
  948. X
  949. X
  950. XDMAKE(p)               Unsupported Software               DMAKE(p)
  951. X
  952. X
  953. X
  954. XNAME
  955. X     dmake - maintain program groups, or interdependent files
  956. X
  957. XSYNOPSIS
  958. X     dmake [-AeEhiknpqersStTuvVx] [-P#] [macro[*][+][:]=value]
  959. X     [-f file] [target ...]
  960. X
  961. XDESCRIPTION
  962. X     dmake executes commands found in an external file called a
  963. X     makefile to update one or more target names.  Each target
  964. X     may depend on zero or more prerequisite targets.  If any of
  965. X     the target's prerequisites is newer than the target or if
  966. X     the target itself does not exist, then dmake will attempt to
  967. X     make the target.
  968. X
  969. X     If no -f command line option is present then dmake searches
  970. X     for an existing makefile from the list of prerequisites
  971. X     specified for the special target .MAKEFILES (see the STARTUP
  972. X     section for more details).  If "-" is the name of the file
  973. X     specified to the -f flag then dmake uses standard input as
  974. X     the source of the makefile text.
  975. X
  976. X     Any macro definitions (arguments with embedded "=" signs)
  977. X     that appear on the command line are processed first and
  978. X     supercede definitions for macros of the same name found
  979. X     within the makefile.  In general it is impossible for defin-
  980. X     itions found inside the makefile to redefine a macro defined
  981. X     on the command line, see the MACROS section for an excep-
  982. X     tion.
  983. X
  984. X     If no target names are specified on the command line, then
  985. X     dmake uses the first non-special target found in the
  986. X     makefile as the default target.  See the SPECIAL TARGETS
  987. X     section for the list of special targets and their function.
  988. X     dmake is a re-implementation of the UNIX Make utility with
  989. X     significant enhancements.  Makefiles written for most previ-
  990. X     ous versions of make will be handled correctly by dmake.
  991. X     Known differences between dmake and other versions of make
  992. X     are discussed in the COMPATIBILITY section found at the end
  993. X     of this document.
  994. X
  995. XOPTIONS
  996. X     -A   Enable AUGMAKE special inference rule transformations
  997. X          (see the "PERCENT(%) RULES" section), these are set to
  998. X          off by default.
  999. X
  1000. X     -e   Read the environment and define all strings of the form
  1001. X          'ENV-VAR=evalue' defined within as macros whose name is
  1002. X          ENV-VAR, and whose value is 'evalue'.  The environment
  1003. X          is processed prior to processing the user specified
  1004. X          makefile thereby allowing definitions in the makefile
  1005. X          to override definitions in the environment.
  1006. X
  1007. X
  1008. X
  1009. XVersion 3.50                    UW                              1
  1010. X
  1011. X
  1012. X
  1013. X
  1014. XDMAKE(p)               Unsupported Software               DMAKE(p)
  1015. X
  1016. X
  1017. X
  1018. X     -E   Same as -e, except that the environment is processed
  1019. X          after the user specified makefile has been processed
  1020. X          (thus definitions in the environment override defini-
  1021. X          tions in the makefile).  The -e and -E options are
  1022. X          mutually exclusive.  If both are given the latter one
  1023. X          takes effect.
  1024. X
  1025. X     -f file
  1026. X          Use file as the source for the makefile text.  Only one
  1027. X          -f option is allowed.
  1028. X
  1029. X     -h   Print the command summary for dmake.
  1030. X
  1031. X     -i   Tells dmake to ignore errors, and continue making other
  1032. X          targets.  This is equivalent to the .IGNORE attribute
  1033. X          or macro.
  1034. X
  1035. X     -k   Causes dmake to ignore errors caused by command execu-
  1036. X          tion and to make all targets not depending on targets
  1037. X          that could not be made. Ordinarily dmake stops after a
  1038. X          command returns a non-zero status, specifying -k causes
  1039. X          dmake to ignore the error and continue to make as much
  1040. X          as possible.
  1041. X
  1042. X     -n   Causes dmake to print out what it would have executed,
  1043. X          but does not actually execute the commands.  A special
  1044. X          check is made for the string "$(MAKE)" inside a recipe
  1045. X          line, if found, the line is expanded and invoked,
  1046. X          thereby enabling recursive makes to give a full
  1047. X          description of all that they will do.  The check for
  1048. X          "$(MAKE)" is disabled inside group recipes.
  1049. X
  1050. X     -p   Print out a version of the digested makefile in human
  1051. X          readable form.  (useful for debugging, but cannot be
  1052. SHAR_EOF
  1053. echo "End of part 15"
  1054. echo "File man/dmake.nc is continued in part 16"
  1055. echo "16" > s2_seq_.tmp
  1056. exit 0
  1057.  
  1058.